package com.ruoyi.system.service.impl;

import java.util.Collections;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.TbTrainNumberMapper;
import com.ruoyi.system.domain.TbTrainNumber;
import com.ruoyi.system.service.ITbTrainNumberService;

/**
 * 车次Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-04-21
 */
@Service
public class TbTrainNumberServiceImpl implements ITbTrainNumberService 
{
    @Autowired
    private TbTrainNumberMapper tbTrainNumberMapper;

    /**
     * 查询车次
     * 
     * @param id 车次主键
     * @return 车次
     */
    @Override
    public TbTrainNumber selectTbTrainNumberById(Long id)
    {
        return tbTrainNumberMapper.selectTbTrainNumberById(id);
    }

    /**
     * 查询车次列表
     * 
     * @param tbTrainNumber 车次
     * @return 车次
     */
    @Override
    public List<TbTrainNumber> selectTbTrainNumberList(TbTrainNumber tbTrainNumber)
    {
        return tbTrainNumberMapper.selectTbTrainNumberList(tbTrainNumber);
    }

    /**
     * 新增车次
     * 
     * @param tbTrainNumber 车次
     * @return 结果
     */
    @Override
    public int insertTbTrainNumber(TbTrainNumber tbTrainNumber)
    {
        tbTrainNumber.setCreateTime(DateUtils.getNowDate());
        return tbTrainNumberMapper.insertTbTrainNumber(tbTrainNumber);
    }

    /**
     * 修改车次
     * 
     * @param tbTrainNumber 车次
     * @return 结果
     */
    @Override
    public int updateTbTrainNumber(TbTrainNumber tbTrainNumber)
    {
        return tbTrainNumberMapper.updateTbTrainNumber(tbTrainNumber);
    }

    /**
     * 批量删除车次
     * 
     * @param ids 需要删除的车次主键
     * @return 结果
     */
    @Override
    public int deleteTbTrainNumberByIds(Long[] ids)
    {
        return tbTrainNumberMapper.deleteTbTrainNumberByIds(ids);
    }

    /**
     * 删除车次信息
     * 
     * @param id 车次主键
     * @return 结果
     */
    @Override
    public int deleteTbTrainNumberById(Long id)
    {
        return tbTrainNumberMapper.deleteTbTrainNumberById(id);
    }

    @Override
    public List<TbTrainNumber> inquireAboutTheTrainSchedule() {

        return this.tbTrainNumberMapper.selectTbTrainNumberList(new TbTrainNumber());
    }
}
